package com.etone.smartAudit.controller;

import com.etone.smartAudit.service.DataMetaService;
import com.etone.smartAudit.vo.PagerVO;
import com.etone.smartAudit.vo.dataMeta.DataMetaVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: sovy
 * @date: 2020/11/18
 * @description:
 */
@RestController
@AllArgsConstructor
@Api(tags = "数据模型数据字典", value = "DataMetaController")
public class DataMetaController {

    private DataMetaService dataMetaService;

    @GetMapping("/dataMetas")
    @ApiOperation(value = "数据字典列表")
    public PagerVO<DataMetaVO> list(
            @ApiParam(value = "当前页") @RequestParam(required = false, defaultValue = "1") int page,
            @ApiParam(value = "每页显示数量") @RequestParam(required = false, defaultValue = "10") int pageSize,
            @ApiParam(value = "模型id", required = true) @RequestParam Integer dataModeId,
            @ApiParam(value = "关键字(字段名称，说明)") @RequestParam(required = false) String keys
    ) {
        return dataMetaService.list(dataModeId, keys, page, pageSize);
    }
}
